Skip to content

unify(gamemessage): Merge MessageStream, MetaEvent code#2756

Merged
xezon merged 1 commit into
TheSuperHackers:mainfrom
xezon:xezon/unify-metaevent
May 30, 2026
Merged

unify(gamemessage): Merge MessageStream, MetaEvent code#2756
xezon merged 1 commit into
TheSuperHackers:mainfrom
xezon:xezon/unify-metaevent

Conversation

@xezon
Copy link
Copy Markdown

@xezon xezon commented May 29, 2026

This change merges code in MessageStream, MetaEvent.

There should be no logical change, except allowing MSG_META_DEMO_INSTANT_QUIT in Multiplayer Debug.

@xezon xezon added Gen Relates to Generals Unify Unifies code between Generals and Zero Hour labels May 29, 2026
@xezon xezon changed the title unify(message): Merge MessageStream, MetaEvent code unify(gamemessage): Merge MessageStream, MetaEvent code May 29, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 29, 2026

Greptile Summary

This PR syncs MessageStream enum values and MetaEvent lookup tables between Generals and GeneralsMD, adding new message types (MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE, MSG_CHEAT_* under _ALLOW_DEBUG_CHEATS_IN_RELEASE, new debug performance/audio entries, MSG_SABOTAGE_HINT, MSG_ENABLE_RETALIATION_MODE) and removing MSG_META_DEMO_INSTANT_QUIT from the multiplayer-debug blocklist to align Generals behaviour with Zero Hour.

  • Generals MessageStream.h: New enum entries added across several conditional blocks; a handful of lines use spaces instead of tabs, inconsistent with the surrounding code.
  • Generals MetaEvent.cpp: Lookup table updated to mirror the new enums; column alignment in the _ALLOW_DEBUG_CHEATS_IN_RELEASE block is uneven (mixed tabs/spaces). A disabled key-logging debug scaffold (dont_DUMP_ALL_KEYS_TO_LOG) is also introduced.
  • GeneralsMD files: Only trivial whitespace/blank-line cleanup, no functional change.

Confidence Score: 5/5

Safe to merge — all changes are enum/lookup table additions and cosmetic cleanup with no new logic paths in production code.

The change is a straightforward sync of enum declarations and lookup table entries between the two game targets. The only behavioural difference (MSG_META_DEMO_INSTANT_QUIT in multiplayer debug) is explicitly approved. The disabled debug scaffold and mixed indentation are cosmetic and do not affect runtime behaviour.

No files require special attention.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Include/Common/MessageStream.h Syncs new enum values from GeneralsMD: adds MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE, MSG_CHEAT_* block under _ALLOW_DEBUG_CHEATS_IN_RELEASE, new debug performance/audio entries, MSG_SABOTAGE_HINT. Several new lines use spaces instead of tabs, inconsistent with the rest of the file.
Generals/Code/GameEngine/Source/Common/MessageStream.cpp Adds CASE_LABEL entries to getCommandTypeAsString() to match new enum values, including MSG_ENABLE_RETALIATION_MODE which was previously missing. Removes MSG_META_DEMO_INSTANT_QUIT from isInvalidDebugCommand (intentional, per reviewer approval).
Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp Syncs lookup table entries to match new enum values. Adds a disabled debug key-logging block (dont_DUMP_ALL_KEYS_TO_LOG) and adds braces around the MSG_RAW_KEY_DOWN handler — logic is unchanged. Column alignment in the new _ALLOW_DEBUG_CHEATS_IN_RELEASE block is inconsistent.
GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h Removes two trailing blank lines before MSG_END_NETWORK_MESSAGES. No functional change.
GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp Removes a single blank line before the MetaMap loop — purely cosmetic, no functional change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Raw Input / Key Event] --> B[MetaEventTranslator::translateGameMessage]
    B --> C{MSG_RAW_KEY_DOWN?}
    C -- Yes --> D[Record m_lastKeyDown\n+ optional DUMP_ALL_KEYS_TO_LOG]
    C -- No --> E[Skip key record]
    D --> F[Update m_lastModState]
    E --> F
    F --> G{Lookup MetaMap}
    G --> H{isMessageUsable?}
    H -- Yes --> I[Append meta message\nto TheMessageStream]
    H -- No --> J[Skip]
    I --> K{isInvalidDebugCommand?}
    K -- Blocked --> L[Discard in multiplayer]
    K -- Allowed --> M[Process GameMessage\ne.g. MSG_META_DEMO_INSTANT_QUIT\nnow allowed in MP Debug]
Loading
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
Generals/Code/GameEngine/Include/Common/MessageStream.h:275-304
**Mixed indentation in new enum entries**

Several newly added enum entries use 4 spaces for indentation while all surrounding entries use tabs. This creates visual inconsistency in the enum block. Affected lines: `MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE` (line 275), `MSG_CHEAT_RUNSCRIPT1` (line 285), and `MSG_CHEAT_TOGGLE_MESSAGE_TEXT` (line 304) should all be indented with a tab to match the rest of the file.

### Issue 2 of 3
Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp:190-213
**Inconsistent column alignment in cheat lookup table block**

The `_ALLOW_DEBUG_CHEATS_IN_RELEASE` block in `GameMessageMetaTypeNames[]` mixes tabs and spaces to reach the `GameMessage::` column, resulting in misaligned columns across entries. Per the project's style for data-oriented blocks, the value column should be consistently aligned. Compare entries like `"CHEAT_DESHROUD"` (uses spaces + trailing spaces) against `"CHEAT_RUNSCRIPT1"` (uses tabs). The same pattern appears for `"DEMO_SHOW_AUDIO_LOCATIONS"` and `"DEMO_SHOW_HEALTH"` around line 285 of the same file.

### Issue 3 of 3
Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp:56-62
**Disabled debug logging block left in production code**

`dont_DUMP_ALL_KEYS_TO_LOG` is defined immediately before the `#ifdef DUMP_ALL_KEYS_TO_LOG` block, meaning this debug key-logging code is permanently dead unless the `dont_` prefix is manually removed. The block brings in a `Keyboard.h` include and `DEBUG_LOG` output — worth confirming this scaffolding is intentionally retained rather than accidentally committed.

Reviews (2): Last reviewed commit: "unify(message): Merge MessageStream, Met..." | Re-trigger Greptile

Comment thread Generals/Code/GameEngine/Source/Common/MessageStream.cpp
@Mauller
Copy link
Copy Markdown

Mauller commented May 30, 2026

@greptile re-review this pr and ignore the MSG_META_DEMO_INSTANT_QUIT change as the behavioural change is okay and brings the behaviour of generals in-line with zero hour.

Copy link
Copy Markdown

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall, only alignment issues that might want fixing in both games files.

Comment thread Generals/Code/GameEngine/Include/Common/MessageStream.h
Comment thread Generals/Code/GameEngine/Include/Common/MessageStream.h
Comment thread Generals/Code/GameEngine/Include/Common/MessageStream.h
Comment thread Generals/Code/GameEngine/Include/Common/MessageStream.h
@xezon xezon added this to the Code foundation build up milestone May 30, 2026
@xezon xezon merged commit 8a06f35 into TheSuperHackers:main May 30, 2026
17 checks passed
@xezon xezon deleted the xezon/unify-metaevent branch May 30, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Unify Unifies code between Generals and Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants